import request from '@/utils/request';

// 上传至服务器
// 追加上传所使用的 position,首次上传为0

const XHRUploadService = (tempFile, sysCode = 'OA', keyName) => {
    const tempFormData = new FormData();
    if (tempFile.file) {
        tempFormData.append('file', tempFile.file);
    }
    const options = {
        method: 'POST',
        requestType: 'form',
        data: tempFormData
    };
    const remoteUrl = `/api/resource/oss/v1/appendFile/${sysCode}/${keyName}`;

    return request(remoteUrl, options);
};

export default XHRUploadService;
